import {environment} from '../../../environments/environment';

export class WebHelper {
  public static setLocalItem(key: string, value: string): void {
    localStorage.setItem(key, value);
  }

  public static getLocalItem(key: string): string {
    return localStorage.getItem(key);
  }

  public static removeLocalItem(key: string): void {
    localStorage.removeItem(key);
  }

  public static setSessionItem(key: string, value: string): void {
    sessionStorage.setItem(key, value);
  }

  public static getSessionItem(key: string): string {
    return sessionStorage.getItem(key);
  }

  public static removeSessionItem(key: string): void {
    sessionStorage.removeItem(key);
  }
}

export class WebUrlHelper {
  public static getLocationPath(): string {
    let path = window.location.pathname;
    if (environment.baseHref) {
      path = path.replace(environment.baseHref, '');
    }

    return path;
  }

  public static getLocationOrigin(): string {
    return window.location.origin + environment.baseHref;
  }
}

export enum WebStorageKey {
}
